package com.simen.connectandroid.model;

/**
 * Created on 2021/10/30 14:50.
 *
 * @author Simen
 */
public enum DeviceStatus {

    offline(0), online(1), unknown(-1);

    private int value;

    DeviceStatus(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public static DeviceStatus parse(String statusLog) {
        if (statusLog != null) {
            if (statusLog.toLowerCase().contains("device")) {
                return online;
            } else if (statusLog.toLowerCase().contains("offline")) {
                return offline;
            }
        }
        return unknown;
    }
}
